using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using System.Data;
namespace DAO
{
    public class NhanVien :Interface
    {
        public static bool PhatSinhMaNhanVien(DTO.NhanVien nv)
       {
           string sql = "select MaNhanVien from NhanVien";
           DataTable dt = Interface.SelectTest(sql);
           if (dt != null)
           {
               DataRow dr = dt.Rows[dt.Rows.Count-1];
               int ma = int.Parse(dr["MaNhanVien"].ToString());
               ma++;
               nv.MaNhanVien = ma.ToString();
               return true;
           }
           else
               return false;
       }
       public static bool ThemNhanVien(DTO.NhanVien nv)
       {
           string sql = "insert into NhanVien values (N'";
           sql += nv.MaNhanVien + "',N'";
           sql += nv.HoTen+"',N'";
           sql += nv.DiaChi + "','";
           sql += nv.NgaySinh + "','";
           sql += nv.DienThoai + "','";
           sql += nv.MaBangCap + "','";
           sql += nv.MaBoPhan + "','";
           sql += nv.MaChucVu + "')";
           bool result = Interface.InsertTest(sql);
           return result;
       }
    }
}
